package com.yzd.learnjava.strings;

import java.util.Arrays;
import java.util.Scanner;
import java.util.StringTokenizer;

import com.yzd.learnjava.util.Print;
/*
 * StringTokenizer
 */
public class ReplacingStringTokenizer {
	public static void main(String[] args) {
		String input = "But i am not dead yet! I free haapy!";
		StringTokenizer tokenizer = new StringTokenizer(input);
		while(tokenizer.hasMoreElements()) {
			Print.printnb(tokenizer.nextToken() + " ");
		}
		Print.print();
		Print.printnb(Arrays.toString(input.split(" ")));
		
		Print.print();
		Scanner scanner = new Scanner(input);
		while(scanner.hasNext()) {
			Print.printnb(scanner.next() + " ");
		}
	}
}
